<template>
  <div class="home">
    <!-- Hero Section -->
    <section class="hero">
      <div class="container">
        <div class="hero-content">
          <h1 class="hero-title" v-typewriter="'嗨，我是前端开发者'">嗨，我是前端开发者</h1>
          <p class="hero-subtitle" data-aos="fade-up" data-aos-delay="200">
            我专注于构建现代化、响应式和高性能的网站与应用程序。
          </p>
          <div class="hero-actions" data-aos="fade-up" data-aos-delay="400">
            <router-link to="/projects" class="btn btn-primary">查看我的项目</router-link>
            <router-link to="/contact" class="btn btn-outline">联系我</router-link>
          </div>
        </div>
        <div class="hero-image" data-aos="zoom-in" data-aos-delay="200">
          <div class="hero-shape"></div>
        </div>
      </div>
    </section>

    <!-- Skills Section -->
    <section class="section skills-section">
      <div class="container">
        <h2 class="section-title" data-aos="fade-up">技能 & 工具</h2>
        <div class="skills-container" data-aos="fade-up" data-aos-delay="200">
          <div v-for="(skill, index) in skills" :key="index" class="skill-item" v-hover-effect data-aos="fade-up" :data-aos-delay="200 + (index * 50)">
            <div class="skill-icon">{{ skill.icon }}</div>
            <h3 class="skill-name">{{ skill.name }}</h3>
          </div>
        </div>
      </div>
    </section>

    <!-- Featured Projects Section -->
    <section class="section projects-section">
      <div class="container">
        <h2 class="section-title" data-aos="fade-up">精选项目</h2>
        <div class="grid">
          <ProjectCard 
            v-for="(project, index) in featuredProjects" 
            :key="index" 
            :project="project"
            data-aos="fade-up"
            :data-aos-delay="200 + (index * 100)"
          />
        </div>
        <div class="view-all" data-aos="fade-up" data-aos-delay="600">
          <router-link to="/projects" class="btn btn-outline">查看全部项目</router-link>
        </div>
      </div>
    </section>
  </div>
</template>

<script>
import ProjectCard from '../components/common/ProjectCard.vue'

export default {
  name: 'Home',
  components: {
    ProjectCard
  },
  data() {
    return {
      skills: [
        { name: 'HTML5', icon: '🌐' },
        { name: 'CSS3', icon: '🎨' },
        { name: 'JavaScript', icon: '⚡' },
        { name: 'Vue.js', icon: '💚' },
        { name: 'React', icon: '⚛️' },
        { name: 'Node.js', icon: '🔧' }
      ],
      featuredProjects: [
        {
          title: '电子商务平台',
          description: '一个现代化的电子商务平台，拥有用户验证、产品搜索、购物车和支付整合功能。',
          image: 'https://via.placeholder.com/600x350',
          technologies: ['Vue.js', 'Vuex', 'Node.js', 'Express', 'MongoDB'],
          liveUrl: '#',
          codeUrl: '#'
        },
        {
          title: '任务管理应用',
          description: '一个简洁但功能强大的任务管理应用，具有拖放功能、标签分类和提醒系统。',
          image: 'https://via.placeholder.com/600x350',
          technologies: ['React', 'Redux', 'Firebase', 'SCSS'],
          liveUrl: '#',
          codeUrl: '#'
        },
        {
          title: '天气应用',
          description: '实时天气应用，提供详细的天气预报、地图集成和位置搜索功能。',
          image: 'https://via.placeholder.com/600x350',
          technologies: ['Vue.js', 'Axios', 'Weather API', 'GSAP'],
          liveUrl: '#',
          codeUrl: '#'
        }
      ]
    }
  }
}
</script>

<style scoped lang="scss">
.hero {
  height: 100vh;
  min-height: 700px;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, rgba(196, 113, 237, 0.05) 0%, rgba(18, 194, 233, 0.03) 50%, transparent 100%);
    z-index: -1;
  }
  
  .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
  }
  
  .hero-content {
    flex: 1;
    
    .hero-title {
      font-size: 3.5rem;
      font-weight: 700;
      margin-bottom: 1.5rem;
      background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }
    
    .hero-subtitle {
      font-size: 1.2rem;
      color: var(--text-muted);
      margin-bottom: 2.5rem;
      max-width: 600px;
      line-height: 1.8;
    }
    
    .hero-actions {
      display: flex;
      gap: 1rem;
    }
  }
  
  .hero-image {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    
    .hero-shape {
      width: 400px;
      height: 400px;
      background: linear-gradient(45deg, var(--primary-color), var(--secondary-color), var(--accent-color));
      border-radius: 58% 42% 38% 62% / 42% 55% 45% 58%;
      animation: morph 8s ease-in-out infinite;
      transition: all 1s ease-in-out;
      position: relative;
      
      &::before {
        content: '';
        position: absolute;
        top: 2px;
        right: 2px;
        bottom: 2px;
        left: 2px;
        background: #111;
        border-radius: 58% 42% 38% 62% / 42% 55% 45% 58%;
        z-index: 0;
      }
      
      &::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        background: linear-gradient(45deg, var(--primary-color), var(--secondary-color), var(--accent-color));
        filter: blur(15px);
        opacity: 0.7;
        z-index: -1;
        border-radius: 58% 42% 38% 62% / 42% 55% 45% 58%;
      }
    }
  }
}

.skills-section {
  background: #0d0d0d;
  
  .skills-container {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center;
    margin-top: 2rem;
  }
  
  .skill-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 2rem;
    width: 150px;
    height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    
    &:hover {
      background: rgba(255, 255, 255, 0.05);
      transform: translateY(-5px);
      box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    }
    
    .skill-icon {
      font-size: 2.5rem;
      margin-bottom: 1rem;
    }
    
    .skill-name {
      font-size: 1rem;
      color: var(--text-color);
      font-weight: 500;
    }
  }
}

.projects-section {
  .view-all {
    text-align: center;
    margin-top: 3rem;
  }
}

@keyframes morph {
  0% {
    border-radius: 58% 42% 38% 62% / 42% 55% 45% 58%;
  }
  50% {
    border-radius: 31% 69% 59% 41% / 28% 24% 76% 72%;
  }
  100% {
    border-radius: 58% 42% 38% 62% / 42% 55% 45% 58%;
  }
}

@media (max-width: 992px) {
  .hero {
    .container {
      flex-direction: column;
      justify-content: center;
      text-align: center;
    }
    
    .hero-content {
      .hero-title {
        font-size: 2.8rem;
      }
      
      .hero-subtitle {
        margin: 0 auto 2.5rem;
      }
      
      .hero-actions {
        justify-content: center;
      }
    }
    
    .hero-image {
      margin-top: 2rem;
      
      .hero-shape {
        width: 300px;
        height: 300px;
      }
    }
  }
}

@media (max-width: 768px) {
  .hero {
    .hero-content {
      .hero-title {
        font-size: 2.2rem;
      }
    }
    
    .hero-image {
      .hero-shape {
        width: 250px;
        height: 250px;
      }
    }
  }
  
  .skills-section {
    .skill-item {
      width: 120px;
      height: 120px;
      padding: 1.5rem;
      
      .skill-icon {
        font-size: 2rem;
      }
    }
  }
}
</style> 